<template>
    <fieldset>
        <legend>Child2</legend>
        <h1>兄弟组件2</h1>
        <button @click="send">点击传参给兄弟1组件</button>
        <input type="text" :value="f" @input="ipt">
        <h2>{{x}}</h2>
    </fieldset>
</template>
<script>
import bus from "../utils/bus"
export default {
    props: ['f', 'x'],
    data() {
        return {
            food: "香蕉"
        }
    },
    methods: {
        send() {
            bus.$emit('receive', this.food)
        },
        ipt(e) {
            this.$emit('update:f', e.target.value)
        }
    }
}
</script>